package chapter3.No3_1_等待和通知机制.k通过管道进行线程间通信_字节流;

import java.io.IOException;
import java.io.PipedOutputStream;

/**
 * Created by Administrator on 2016/11/19.
 */
public class WriteDate {
    public void writeMethod(PipedOutputStream pos) {
        try {
            StringBuffer sb = new StringBuffer();
            for (int i = 0; i < 10; i++) {
                byte[] bytes = (i+",").getBytes();
                sb.append((i+","));
                pos.write(bytes);
            }
            System.out.println("写入："+sb.toString());
            pos.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
